package com.gzhu.knowledgeAdmin.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gzhu.knowledgeAdmin.dao.DailyBillMapper;
import com.gzhu.knowledgeAdmin.entity.DailyBill;
import com.gzhu.knowledgeAdmin.service.DailyBillService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DailyBillServiceImpl extends ServiceImpl<DailyBillMapper, DailyBill> implements DailyBillService {
    @Resource
    private DailyBillMapper dailyBillMapper;

    @Override
    public List<DailyBill> getDailyBillBill(String fGsid, String month) {
        List<DailyBill> dailyBills = dailyBillMapper.getDailyBill(fGsid, month);
        for(DailyBill dailyBill : dailyBills) {
            //AI外呼计费总额
            dailyBill.setAiwhjfze(dailyBill.getAiwhjfsc() * dailyBill.getAiwhdj());
            //语音通知计费总额
            dailyBill.setYytzjfze(dailyBill.getYytzjfsc() * dailyBill.getYytzdj());
            //AI坐席费用总额
            dailyBill.setAizxfyze(dailyBill.getAizxjfs() * dailyBill.getAizxdj());
            //人工坐席费用总额
            dailyBill.setRgzxfyze(dailyBill.getRgzxs() * dailyBill.getRgzxdj());
            //人工外呼计费总额
            dailyBill.setRgwhjfze(dailyBill.getRgwhjfsc() * dailyBill.getRgwhdj());
            //短信收费金额
            dailyBill.setDxsfje((dailyBill.getGjdxjfs() + dailyBill.getQfdxjfs()) * dailyBill.getDxdj());
            //总应收金额
            float totalAmount = dailyBill.getAiwhjfze() + dailyBill.getYytzjfze() + dailyBill.getAizxfyze() + dailyBill.getRgzxfyze() + dailyBill.getRgwhjfze() + dailyBill.getDxsfje();
            dailyBill.setZysze(totalAmount);
        }
        return dailyBills;
    }

}
